package com.dragon.repository.domain.dto;

import com.dragon.common.util.BeanUtils;
import com.dragon.repository.entity.ExamineFile;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ExamineFileDTO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键id")
    private Integer id;

    @ApiModelProperty(value = "审核子表id")
    private Integer examineUserId;

    @ApiModelProperty(value = "文件名称")
    private String fileName;

    @ApiModelProperty(value = "附件地址")
    private String url;

    @ApiModelProperty(value = "文件类型：0,图片，1文件")
    private Integer fileType;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;


    public ExamineFileDTO() {}

    public ExamineFileDTO(ExamineFile entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static ExamineFileDTO convert(ExamineFile entity) {
        return new ExamineFileDTO(entity);
    }

    public static List<ExamineFileDTO> convertList(List<ExamineFile> list) {
        List<ExamineFileDTO> resultList = new ArrayList<>();
        for (ExamineFile entity : list) {
            resultList.add(new ExamineFileDTO(entity));
        }
        return resultList;
    }}
